package b2.config
{
	public class EnemyConfig
	{
		//索引
		public var index:int;
		//敌人名称
		public var name:String;
		//敌人详情
		public var description:String;
		//坦克类型
		public var tankIndex:int;
		//生命值
		public var healthPoint:int;
		//能量值
		public var energyPoint:int;
		//攻击值
		public var attackPoint:int;
		//暴击率（千分之数）
		public var criticalAttackRatio:int;
		//防御值
		public var armPoint:int;
		//移动速度
		public var moveVelocity:int;
		//发炮间隔
		public var fireCooldown:int;
		//经验
		public var experience:int;
		//石油
		public var oil:int;
		//掉落战场物品（索引， 几率; 索引， 几率; ...）（几率为千分数）
		public var dropItem:Array;
		//技能
		public var skills:Array;
		
		//是否移动
		public var noMove:Boolean;
		//是否自动开炮
		public var noFire:Boolean;
		//颜色滤镜
		public var filter:Array;
		
		public function EnemyConfig(enemyXML:XML)
		{
			index = enemyXML.index;
			name = enemyXML.name;
			description = enemyXML.description;
			tankIndex = enemyXML.tankIndex;
			healthPoint = enemyXML.healthPoint;
			energyPoint = enemyXML.energyPoint;
			attackPoint = enemyXML.attackPoint;
			criticalAttackRatio = enemyXML.criticalAttackRatio;
			armPoint = enemyXML.armPoint;
			moveVelocity = enemyXML.moveVelocity;
			fireCooldown = enemyXML.fireCooldown;
			experience = enemyXML.experience;
			oil = enemyXML.oil;
			noMove = Boolean(parseInt(enemyXML.noMove));
			noFire = Boolean(parseInt(enemyXML.noFire));
			if (enemyXML.filter != undefined)
				filter = enemyXML.filter.split(",");
			if (enemyXML.dropItem != undefined)
				dropItem = enemyXML.dropItem.split(";");
			skills = new Array();
			for (var i:int = 0; i < enemyXML.skill.length(); i++)
			{
				var skillConfig:EnemySkillConfig = new EnemySkillConfig(enemyXML.skill[i]);
				skills.push(skillConfig);
			}
		}

	}
}